$OpenBSD: patch-libk3b_core_k3bglobals_cpp,v 1.1.1.1 2008/05/11 22:18:35 jakemsr Exp $
--- libk3b/core/k3bglobals.cpp.orig	Fri Nov  2 02:55:39 2007
+++ libk3b/core/k3bglobals.cpp	Sat Apr  5 18:07:55 2008
@@ -46,13 +46,19 @@
 #include <sys/utsname.h>
 #include <sys/stat.h>
 
-#if defined(__FreeBSD__) || defined(__NetBSD__)
+#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
 #  include <sys/param.h>
 #  include <sys/mount.h>
 #  include <sys/endian.h>
-#  define bswap_16(x) bswap16(x)
-#  define bswap_32(x) bswap32(x)
-#  define bswap_64(x) bswap64(x)
+#  if defined(__OpenBSD__)
+#    define bswap_16(x) swap16(x)
+#    define bswap_32(x) swap32(x)
+#    define bswap_64(x) swap64(x)
+#  else
+#    define bswap_16(x) bswap16(x)
+#    define bswap_32(x) bswap32(x)
+#    define bswap_64(x) bswap64(x)
+#  endif
 #else
 #  include <byteswap.h>
 #endif
@@ -541,7 +547,11 @@ bool K3b::isMounted( K3bDevice::Device* dev )
   if( !dev )
     return false;
 
-  return !KIO::findDeviceMountPoint( dev->blockDeviceName() ).isEmpty();
+  QString mntDev = dev->blockDeviceName();
+#ifdef Q_OS_OPENBSD
+  mntDev.replace(QRegExp("/dev/rcd"), "/dev/cd");
+#endif
+  return !KIO::findDeviceMountPoint( mntDev ).isEmpty();
 }
 
 
@@ -551,6 +561,9 @@ bool K3b::unmount( K3bDevice::Device* dev )
     return false;
 
   QString mntDev = dev->blockDeviceName();
+#ifdef Q_OS_OPENBSD
+  mntDev.replace(QRegExp("/dev/rcd"), "/dev/cd");
+#endif
 
 #if KDE_IS_VERSION(3,4,0)
   // first try to unmount it the standard way
@@ -562,8 +575,12 @@ bool K3b::unmount( K3bDevice::Device* dev )
   if( !umountBin.isEmpty() ) {
     KProcess p;
     p << umountBin;
+#ifndef Q_OS_OPENBSD
     p << "-l"; // lazy unmount
     p << dev->blockDeviceName();
+#else
+    p << mntDev;
+#endif
     p.start( KProcess::Block );
     if( !p.exitStatus() )
       return true;
@@ -595,6 +612,9 @@ bool K3b::mount( K3bDevice::Device* dev )
     return false;
 
   QString mntDev = dev->blockDeviceName();
+#ifdef Q_OS_OPENBSD
+  mntDev.replace(QRegExp("/dev/rcd"), "/dev/cd");
+#endif
 
 #if KDE_IS_VERSION(3,4,0)
   // first try to mount it the standard way
@@ -608,7 +628,11 @@ bool K3b::mount( K3bDevice::Device* dev )
 #endif
 
   // now try pmount
+#ifdef Q_OS_OPENBSD
+  QString pmountBin = K3b::findExe( "mount" );
+#else
   QString pmountBin = K3b::findExe( "pmount" );
+#endif
   if( !pmountBin.isEmpty() ) {
     KProcess p;
     p << pmountBin;
